'''
验证码处理的处理方式：
    注释验证码（建议）
    万能码（建议）
    调用图片识别插件
    添加 cookie ，绕过验证
'''
from selenium import webdriver
from time import sleep
chrome_location = r'D:\chrom browser\chrome-win\chrome.exe'
options = webdriver.ChromeOptions()
options.binary_location = chrome_location
dr = webdriver.Chrome(options=options)
dr.get(r'https://www.baidu.com/')
dr.maximize_window()
sleep(3)
#通过百度的cookie登录 BADUID和BDUSS
cookie1={'name':'BAIDUID','value':'573D23162C2DBC6C93E1C135CA4CB45D:SL=0:NR=10:FG=1'}
cookie2={'name':'BDUSS_BFESS','value':'ko1a1ROSFFQM3RwU3pUNllGUkh3MFN0cWVqY35FRUhLMWR5MWZPSzFyOVYzYnhsRUFBQUFBJCQAAAAAAQAAAAEAAABeCQQDvviwrrui0cDDyMnZxOoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFVQlWVVUJVle'}
dr.add_cookie(cookie1)
dr.add_cookie(cookie2)
dr.refresh()
sleep(3)
dr.quit()